package com.you.atlas.web.home.module.screen;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.dataresolver.Param;
import com.you.common.webx.AuthContext;
import com.you.member.dal.dao.AccountBindDAO;
import com.you.member.dal.dao.dataobject.AccountBindDO;

public class DoubanSync {

    @Autowired
    private AccountBindDAO accountBindDAO;

    public void execute(@Param("type") String type, Context context) {
        AccountBindDO accountBindDO = accountBindDAO.findByMemberId(AuthContext.getContext().getMemberId());
        if (accountBindDO != null) {
            if ("OPEN".equals(type)) {
                accountBindDO.setDoubanSync("OPEN");
            } else {
                accountBindDO.setDoubanSync("CLOSE");
            }
            accountBindDAO.update(accountBindDO);
        }
    }
}
